/*
 * LinkObject.java
 * 
 * Written by Joseph Bowbeer and released to the public domain,
 * as explained at http://creativecommons.org/licenses/publicdomain
 */

package jozart.dynamictree;

/**
 * Links a local tree node to its remote counterpart. Links are stored in
 * DefaultMutableTreeNode's userObject; the link's name provides the node's
 * string representation.
 * 
 * @author Joseph Bowbeer
 * @version 1.1
 */
public class LinkObject implements java.io.Serializable {

    /** Link name. */
    private final String name;

    /** Linked object. */
    private final Object obj;

    /** Constructs a named link to <tt>obj</tt>. */
    public LinkObject(String name, Object obj) {
        this.name = name;
        this.obj = obj;
    }

    /**
     * Returns linked object. 
     * @return linked object
     */
    public Object getObject() {
        return obj;
    }

    /**
     * Returns name of link.
     * @return link name
     */
    public String toString() {
        return name;
    }
}
